package com.hy.study.practice.search;

/**
 * 顺序查找
 */
public class SeqSearch {

    public static void main(String[] args) {
        int arr[] = {1, 2, 4, 5, 3, 5, 3, 5, 2, 5, 9};
        System.out.println(seqSearch(arr, 4));
    }

    private static int seqSearch(int[] arr, int value) {
        for (int i = 0; i < arr.length; i++) {
            if (value == arr[i]) {
                return i;
            }
        }
        return -1;
    }
}
